import { routerRedux } from 'dva/router';
import {
    getLogList,
    getDepList, addDep, updateDep, delDep,
    getGlobalMenuList, getRoleMenuList, getRoleList, addRole, updateRole, delRole,
    getUserList, getUserDetail, addUser, updateUser, delUsers,
    upload, updatePwd
} from '../services/permissionService';
import moment from 'moment';

const initialState = {
    depList:[],
    currentDep:{},
    expandedKeys:[],
    roleList:[],
    globalMenuList:[],
    currentPage:1,
    total:0
};

export default {
    namespace: 'pv',
    state: initialState,
    effects: {
        *fetchDepList(action, { call, put, select }){
            let { user:{ companyId }} = yield select();
            let { data } = yield call(getDepList, { companyId });
            if ( data && data.code === 200 ) {
                yield put({ type:'getDepListResult', payload:{ data:data.data }});
            }
        },
        
        
    },
    reducers: {
        toggleLoading(state){
            return { ...state, isLoading:true };
        }
        
        
    }
};
